﻿using System;
using System.Collections.Generic;

namespace MLog.Core {
    public class EventRecodingLogger : BaseLogger {
        private readonly Queue<LoggerEvent> _eventQueue;

        public EventRecodingLogger(Queue<LoggerEvent> eventQueue) {
            if (eventQueue == null) throw new ArgumentNullException("eventQueue");
            _eventQueue = eventQueue;
        }

        public override void LogEvent(LoggerEvent @event) {
            if (IsLogTypeAllowed(@event.Level)) {
                _eventQueue.Enqueue(@event.Copy());
            }
        }
    }
}